
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/platform/include/include.jsp"%>
<html>
<head>
<TITLE><c:out value="${_LOGONUSER_.MANAGETITILE}" /></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<%@ include file="/jsp/platform/include/header.jsp"%>

	<script type="text/javascript">
		//设置角色菜单关联
		    function adjustApplyTaskAdd() {
		        var checkStr =   "need|adjustAccount|系统账户|"+ $("#adjustAccount").val()+";"
		                        +"double|transAmt|入账金额|"+ $("#transAmt").val()+";"
		                        +"double|transAmt|入账金额|"+ $("#transAmt").val()+";"
		                         ;
		        //检验所有规则
				if (!checkAll(checkStr)) {
					return false;
				}
				var adjustTypeStr = $("input[name^='adjustType']");
                 var adjustType = "";
                 for(i=0;i<adjustTypeStr.length;i++){
                    var isOrNotChecked = adjustTypeStr[i].checked;
                    if(isOrNotChecked){
                       adjustType = adjustTypeStr[i].value;
                    }
                 }
				//检验代理商编号是否存在
				var checkStr = "";
				if(adjustType == "1"){
				   var agenturl = '<%=request.getContextPath()%>/manage/agentInfo/existAgentAndSettleCard';
					$.ajax({
									url:agenturl,
									async : false,
									data:{
										'sysAccount' : $("#adjustAccount").val()
									},
									dataType:"json",
									success:function(data) {
										if (data.success) {
										    if(data.msg=="2"){
										      $.messager
													.alert("提示信息",
															"代理商不存在，请重新输入!");
											  checkStr = "1";				
															return false;
										    }else if(data.msg=="3"){
										      $.messager
													.alert("提示信息",
															"代理商对应的结算信息不存在,不能调账，请重新输入!");
											  checkStr = "1";				
															return false;
										    }
										} else {
											$.messager.alert(
													"提示信息",
													data.msg);
										}
									}
							});
	
				}else{
				    var merchanturl = '<%=request.getContextPath()%>/manage/merchantInfo/existMerchantInfoAndSettleCard';
					$.ajax({
									url:merchanturl,
									async : false,
									data:{
										'sysAccount' : $("#adjustAccount").val()
									},
									dataType : "json",
									success:function(data) {
										if (data.success) {
										    if(data.msg=="2"){
										      $.messager
													.alert("提示信息",
															"商户不存在，请重新输入!");
											checkStr = "1";								
															return false;
										    }else if(data.msg=="3"){
										      $.messager
													.alert("提示信息",
															"商户对应的结算信息不存在,不能调账，请重新输入!");
											  checkStr = "1";				
															return false;
										    }
										} else {
											$.messager.alert(
													"提示信息",
													data.msg);
										}
									}
								});
	
				}
				if(checkStr != "1"){
				   $.messager.confirm("操作提示", "您确定要执行此操作吗！", function (data) {
			           if(data){
			                 
			                 var applyType = '<c:out value="${_LOGONUSER_.operatorInfoModel.operatorType}"/>';
			                 var operatorName = '<c:out value="${_LOGONUSER_.operatorInfoModel.loginName}"/>';
			                 var url = '<%=request.getContextPath()%>/manage/todoTask/adjustApplyTaskAdd';
									$.ajax({
									       url:url,
									       async : false,
									       data:
										   {
												'adjustLogModel.settleType' : '1',//1单笔 2批量
												'adjustLogModel.adjustType' : adjustType,
												'adjustLogModel.adjustAccount' : $("#adjustAccount").val(),
												'adjustLogModel.transAmt' :  $("#transAmt").val(),
												'adjustLogModel.remark' :  $("#depositBank").val(),
												'todoTaskModel.taskType':'7',//调账申请
												'todoTaskModel.taskOperatorType':'1',
												//	1、	系统人员发起 2、	代理人发起
												'todoTaskModel.applyType':applyType,
												'todoTaskModel.applyOperator':operatorName,
												'todoTaskModel.approveStatus':'0'
											},
											dataType : "json",
											success:function(data) {
												if (data.success) {
													$.messager
															.alert(
																	"提示信息",
																	data.msg,
																	"info",
																	function() {
																		window.location.href = window.location.href;
																	});
												} else {
													$.messager.alert(
															"提示信息",
															data.msg);
												}
											}
										});
								}
							});
				}
		}
	</script>
</HEAD>
<BODY>
	<DIV class="all">
		<%@ include file="/jsp/platform/include/head.jsp"%>
		<%@ include file="/jsp/platform/include/menu.jsp"%>
		<DIV class="mains">
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
				<TBODY>
					<TR valign="top">
						<%@ include file="/jsp/platform/include/mainLeft.jsp"%>
						<TD>
							<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
								<TBODY>
									<TR>
										<TD>
											<TABLE width="180" border="0" cellspacing="0" cellpadding="0">
												<TBODY>
													<TR>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_l.jpg">
														</TD>
														<TD align="center"
															background="<%=request.getContextPath()%>/images/pages_bg.jpg">
															<SPAN class="f_tit1">调账申请</SPAN></TD>
														<TD width="7"><IMG width="7" height="36" alt=""
															src="<%=request.getContextPath()%>/images/pages_r.jpg">
														</TD>
													</TR>
												</TBODY>
											</TABLE></TD>
									</TR>
								</TBODY>
								<TR>
									<TD>
										<div class="pages_con">
											<div class="pages_con_20">
												<FORM name="rechageForm" id="rechageForm"
													action="/buser/BTRANS/0100/1/doInCash" method="post">
													<DIV class="transaction_external">
														<DIV class="clearfix">
															<SPAN class="label cz_label"
																style="width:120px;text-align:right;">调账类型:</SPAN> <SPAN
																class="fund-item"> <INPUT name="adjustType"
																type="radio" maxlength="10" checked value="1"> <SPAN
																	style="color: #333;">代理商 </span> <INPUT name="adjustType"
																	type="radio" maxlength="10"  value="2"> <SPAN
																		style="color: #333;">商户 </span>
															</SPAN>
														</DIV>
														<DIV class="clearfix">
															<SPAN class="label cz_label"
																style="width:120px;text-align:right;">系统账户:</SPAN> <SPAN
																class="fund-item"> <INPUT name="adjustAccount" id="adjustAccount"
																class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
																type="text" maxlength="30">
															</SPAN>
														</DIV>
														<DIV class="clearfix">
															<SPAN class="label cz_label"
																style="width:120px;text-align:right;">入账金额:</SPAN> <SPAN
																class="fund-item"> <INPUT name="transAmt" id="transAmt"
																class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
																type="text" maxlength="10">
															</SPAN>
														</DIV>
														<DIV class="clearfix">
															<SPAN class="label cz_label"
																style="width:120px;text-align:right;">备注:</SPAN> <SPAN
																class="label label_color"><INPUT name="remark" id="remark"
																class="txtbox_cz txtbox_cz_long txtbox_cz_color input_change"
																type="text" maxlength="10">
															</SPAN>
														</DIV>

														<DIV class="note">
															<SPAN class="label cz_label">&nbsp;</SPAN> <A
																class="btn confirm" href="javascript:void(0);"
																style="margin-left:113px;" onClick="adjustApplyTaskAdd()">确认</A>
														</DIV>
														<DIV class="clear">&nbsp;</DIV>
													</DIV>
												</FORM>
												<!--当中内容块结束-->
							</TABLE></TD>
					</TR>
				</TBODY>
			</TABLE>
		</DIV>
		<%@ include file="/jsp/platform/include/foot.jsp"%>
</BODY>
</HTML>
